//
//  AccountProvider.swift
//  TODOApp
//
//  Created by chenyh on 2018/5/30.
//  Copyright © 2018年 chenyh. All rights reserved.
//

struct AccountProvider {
    
    func login(params: (String,String),complement: @escaping (Bool) -> Void ) {
        NetLayerRequestSender().send(ApiRequestManager.login(username: params.0, password: params.1)) { baseModel,error  in
            if error != nil {
                complement(false)
            }else if baseModel!.status == 1 {
                complement(true)
            }
        }
    }
    
    func register(params: (String,String),complement: @escaping (Bool) -> Void ) {
        NetLayerRequestSender().send(ApiRequestManager.register(username: params.0, password: params.1)) { baseModel,error  in
            
            if error != nil {
                complement(false)
            }else if baseModel!.status == 1 {
                complement(true)
            }
        }
    }
}
